package team.hyznrj.studentsys.controller.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;

import team.hyznrj.studentsys.dto.ResultDto;
import team.hyznrj.studentsys.exception.AccountException;
import team.hyznrj.studentsys.exception.FileException;
import team.hyznrj.studentsys.utils.ResultUtil;

/** 
* @author ReMidDream 
* @date 2018年3月6日 下午9:33:41 
* 
*/
@ControllerAdvice
public class ExceptionHandler {

	@org.springframework.web.bind.annotation.ExceptionHandler(value=FileException.class)
	@ResponseBody
	public ResultDto<?> handlerResultException(FileException fileException) {
		return ResultUtil.Error(fileException.getCode(), fileException.getMessage());
	}


	@org.springframework.web.bind.annotation.ExceptionHandler(value=AccountException.class)
	@ResponseBody
	public ResultDto<?> handlerAccountException(AccountException accountException) {
		return ResultUtil.Error(accountException.getCode(), accountException.getMessage());
	}


}
 